package com.sav.common.catalog;

public class Category {
	private int idCategory;
	private int idParentCategory;
	private String name;
	private String description;
	private int orderNum;
	
	public Category() {
		
	}
	
	public Category(int idC, int idPC, String n, String desc, int num) {
		idCategory = idC;
		idParentCategory = idPC;
		name = n;
		description = desc;
		orderNum = num;
	}
	
	public void setIdCategory(int id) {
		idCategory = id;
	}
	
	public int getIdCategory() {
		return idCategory;
	}

	public void setIdParentCategory(int id) {
		idParentCategory = id;
	}
	
	public int getIdParentCategory() {
		return idParentCategory;
	}
	
	public void setName(String n ) {
		name = n;
	}
	
	public String getName() {
		return name;
	}
	
	public void setDescription(String d) {
		description = d;
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setOrderNum(int num) {
		orderNum = num;
	}
	
	public int getOrderNum() {
		return orderNum;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + idCategory;
		result = prime * result + idParentCategory;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + orderNum;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Category other = (Category) obj;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (idCategory != other.idCategory)
			return false;
		if (idParentCategory != other.idParentCategory)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (orderNum != other.orderNum)
			return false;
		return true;
	}
	
}